using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class LaboratioryMap : EntityTypeConfiguration<Laboratiory>
	{
		public LaboratioryMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			// Table & Column Mappings
			this.ToTable("Laboratiories");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.MedicationPlanId).HasColumnName("MedicationPlanId");
			this.Property(t => t.LabRecords).HasColumnName("LabRecords");

			// Relationships
			this.HasOptional(t => t.MedicationPlan)
				.WithMany(t => t.Laboratiories)
				.HasForeignKey(d => d.MedicationPlanId);
				
		}
	}
}

